package com.hod.client.reports;

import java.util.ArrayList;

import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.visualization.client.AbstractDataTable;
import com.google.gwt.visualization.client.DataTable;
import com.google.gwt.visualization.client.visualizations.Table;
import com.hod.client.backend.orm.client.GearsDataObject;

public abstract class DataTableView  {
	public abstract AbstractDataTable createTableData(ArrayList<GearsDataObject> rs);
	public final Widget createTable(ArrayList<GearsDataObject> rs) {
	    final Panel panel = new FlowPanel();
	    // Read data from spreadsheet
        final Table viz = new Table();
        panel.add(viz);
        com.google.gwt.visualization.client.visualizations.Table.Options options = Table.Options.create();
        options.setShowRowNumber(true);
        DataTable dataTable = (DataTable)createTableData(rs);
        viz.draw(dataTable, options);
	    return panel;
	  }


}